/**
 * 精确匹配/严格匹配模式
 */
console.log(/abc/.test('abc')) // true

/**
 * 模糊匹配
 */
console.log(/ab*c/.test('abc')) // true
console.log(/ab*c/.test('ac')) // true
console.log(/ab*c/.test('abcc')) // true
console.log('cabccabcc'.match(/ab*c/)) // [ 'abc', index: 0, input: 'abcc', groups: undefined ]


function escapeRegExp(string) {
    return string.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
    //$&表示整个被匹配的字符串
}

console.log(/abc/.test('abc'));
console.log(escapeRegExp('/abc/'))
console.log(RegExp(escapeRegExp('/abc/')).test('abc'));
console.log('9.12'.match(/[0-9.]/))
console.log('foo,abc,esf'.match(/foo(,)abc\1/))